#if 0
定义一个动物类，有属性：物种、年龄，有行为：奔跑、进食
定义一个鸟类，添加属性翅膀，添加行为飞翔
在主函数中创建鸟的对象，显示鸟的所有属性和让鸟类飞翔。
#endif
#include <iostream>
using namespace std;

class Animal{
public:
	string	kind;
	int 	year;
public:
	Animal(const string& kind, int year)
		:kind(kind),
		year(year)
	{
	
	}
	void runing() { cout << "runing..." << endl; }
	void eat() { cout << "eat..." << endl; }


	const string& getKind() const { return this->kind; }
	int getYear() const { return this->year; }
};

class Bird : public Animal{
public:
	bool  	isFly;
public:
	Bird(const string& kind, int year, bool isFly)
		:Animal(kind, year),
		isFly(isFly)
	{
	
	}
	void fly() { cout << "fly..." << endl; }

	void show() const
	{
		cout << "kind: " << this->getKind() << endl;
		cout << "year: " << this->getYear() << endl;
		cout << "isFly: " << this->isFly << endl;
	}
};

int main(void)
{
/*
	Bird b("飞禽类", 5, true);
	b.fly();
	b.show();


	Animal* p = &b;
	cout << p->kind << endl;
	cout << p->year << endl;
	//cout << p->isFly << endl;

	p->runing();
	p->eat();
	//p->fly();


	static_cast
	const_cast
	dynamic_cast
	reinterrupt_cast
*/
	Animal animal("爬行类", 3);

	Bird* b  = (Bird*)&animal;
	b->fly();
	cout << b->year << endl;
	cout << b->kind << endl;
	cout << b->isFly << endl;

}
